#pragma once

class CDVBRuleTable
{
public:
	CDVBRuleTable(void);
	~CDVBRuleTable(void);
public:
	LPCTSTR GetName(void);
};

typedef struct _element_node
{
	char *pName;
	char *pAttribute;
	_element_node *pNextNode;
	_element_node *pChildNode;
	char status;
	BYTE bProgress;
}element_node;


class CDVBRule
{
public:
	CDVBRule(void);
	~CDVBRule(void);
private:
	void FormatDefaultFile(void);
	BOOL FormatVerify(void);
	element_node* GetTable(int nIndex);
public:
	int GetTableCount(void);
	char* GetTableName(int nIndex);
	BOOL ParseTable(int nIndex, BYTE* pData, char* pLine, BYTE& bPosition);
	BOOL AddTable(DWORD_PTR pTable);
	BOOL RebuildXML(void);
	int GetTableIndex(BYTE table_id);//256 for unknown!
private:
	CFile* m_hRulesFile;
	int m_nTableCount;
	int m_nDescriptorCount;
	BOOL m_bFileUpdated;
};
